package com.douqu.game.core.config;

import com.douqu.game.core.config.common.GoodsData;
import com.douqu.game.core.entity.GameObject;
import com.douqu.game.core.util.LoadUtils;
import com.douqu.game.core.util.LogUtils;

/**
 * @Author: wangzhenfei
 * @Description:
 * @Date: 2017-11-21 18:30
 */
public class ResolveConfig extends GameObject {

    public GoodsData[] goods;

    public int type;

    public int quality;


    @Override
    public boolean check()
    {
        if(goods == null)
        {
            LogUtils.error("ResolveData check goods is null -> id:" + id + " name:" + name);
            return false;
        }
        return true;
    }

    @Override
    public boolean setVariable(String key, String value)
    {
        if("goods".equals(key))
        {
            goods = LoadUtils.loadGoodDataToArray(key, value);
            return LoadUtils.checkGoods(goods, this.getClass(), key, id);
        }
        else
            return super.setVariable(key, value);
    }


}
